package org.jetnuke.common;

import java.util.HashMap;

public class ModuleInfo implements IModuleInfo {

	private boolean active;

	/**
	 * @return Returns the active.
	 */
	public boolean isActive() {
		return active;
	}

	/**
	 * @param active
	 *            The active to set.
	 */
	public void setActive(boolean active) {
		this.active = active;
	}

	private String path;

	private HashMap actionMap = new HashMap();

	private HashMap actionRoleMap = new HashMap();

	private HashMap forwardRoleMap = new HashMap();

	private HashMap forwardMap = new HashMap();

	private HashMap pageMap = new HashMap();

	private String moduleRole;

	private String defaultAction;

	private boolean hasModuleClass;

	private Class moduleClass;

	/**
	 * @param xmlPath
	 */
	public void setPath(String xmlPath) {
		this.path = xmlPath;
	}

	public String getPath() {
		return path;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jetnuke.common.IModuleInfo#getModuleClass()
	 */

	/**
	 * @param role
	 * @param nodeValue
	 * @param nodeValue2
	 */
	public void putAction(String actionName, String actionClassName, String role) {

		actionMap.put(actionName, actionClassName);
		if (role != null) {
			actionRoleMap.put(actionName, role);
		}
	}

	public String getAction(String actionName) {
		return (String) actionMap.get(actionName);
	}

	public void putForward(String fwdName, String templateName, String role) {
		forwardMap.put(fwdName, templateName);
		if (role != null) {
			forwardRoleMap.put(fwdName, role);
		}
	}

	public String getForwardTemplate(String fwdName) {
		return (String) forwardMap.get(fwdName);
	}

	public String getActionRole(String actionName) {
		return (String) actionRoleMap.get(actionName);
	}

	public String getForwardRole(String fwdName) {
		return (String) forwardRoleMap.get(fwdName);
	}

	/**
	 * @param actionName
	 * @param page
	 */
	public void putPage(String actionName, String page) {
		pageMap.put(actionName, page);
	}

	public String getPage(String actionName) {
		return (String) pageMap.get(actionName);
	}

	/**
	 * @param bkey
	 */
	public void setModuleRole(String bkey) {
		this.moduleRole = bkey;

	}

	/**
	 * @return Returns the moduleRole.
	 */
	public String getModuleRole() {
		return moduleRole;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jetnuke.common.IModuleInfo#getDefaultAction()
	 */
	public String getDefaultAction() {
		return defaultAction;

	}

	/**
	 * @param defaultAction
	 *            The defaultAction to set.
	 */
	public void setDefaultAction(String defaultAction) {
		this.defaultAction = defaultAction;
	}
	public boolean hasModuleClass(){
		return hasModuleClass;
	}
	public void setHasModuleClass(boolean b){
		hasModuleClass=b;
	}

	public Class getModuleClass() {
		
		return moduleClass;
	}

	public void setModuleClass(Class moduleClass) {
		this.moduleClass = moduleClass;
	}
}
